//导入工具包
var gulp = require('gulp'),
    less = require('gulp-less'),
    autoprefixer = require('gulp-autoprefixer'),
    cleanCSS = require('gulp-clean-css'),
    fontSpider = require( 'gulp-font-spider' );

var paths = {
    styles: {
        src: 'src/less/*.less',
        dest: 'dist/css'
    }
};

// 编译less 压缩less
// function reduceLess() {
//     return gulp.src('src/less/main.less')
//         .pipe(less())
//         .pipe(autoprefixer())
//         .pipe(cleanCSS())
//         .pipe(gulp.dest(paths.styles.dest));
// }
//
// // 实时编译less
// gulp.task('watch', function() {
//     gulp.watch(paths.styles.src, reduceLess);
// });

// 字蛛
gulp.task('fontspider', function() {
    return gulp.src('page/font.html')
        .pipe(fontSpider());
});


// 编译less 压缩less
gulp.task('reduceLess', function () {
    return gulp.src('src/less/main.less')
        .pipe(less())
        .pipe(cleanCSS())
        .pipe(autoprefixer())
        .pipe(gulp.dest('dist/css'));
});

// 实时编译less
gulp.task('watch', function() {
    gulp.watch(['src/less/*.less'],gulp.series("reduceLess"))
});
